using System;
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.ComponentModel; 
using LibreriaCommon; 

namespace LibreriaWC
{
    /// <summary>
    /// DropDownList de tipos de Salidas (Excel, PDF, etc).
    /// </summary>
    [ToolboxData("<{0}:ddlSalidas runat=server></{0}:ddlSalidas>")] 
    public class ddlSalidas : ddlAbstract 
    { 
		private Constants.SalidasEnum firstElement = Constants.SalidasEnum.Pantalla;

		public ddlSalidas() : base()
		{
		}

		/// <summary>
        /// Primer elemento a mostrar en la lista.
        /// </summary>
        [Category("Misc")] 
        public Constants.SalidasEnum FirstElement 
        { 
            get 
            { 
                return firstElement; 
            } 
            set 
            { 
                firstElement = value; 
            } 
        } 

        /// <summary>
        /// Llenar la lista con los tipos de salida.
        /// </summary>
        public override void Fill() 
        { 
            base.Items.Add(new ListItem("Pantalla", Constants.SalidasEnum.Pantalla.GetHashCode().ToString())); 
            base.Items.Add(new ListItem("Pdf", Constants.SalidasEnum.PDF.GetHashCode().ToString())); 
            base.Items.Add(new ListItem("Excel", Constants.SalidasEnum.Excel.GetHashCode().ToString())); 
            base.Items.Add(new ListItem("Word", Constants.SalidasEnum.Word.GetHashCode().ToString())); 
            SelectByValue(this.FirstElement.GetHashCode().ToString());
            Filled = true; 
        } 

        /// <summary>
        /// Tipo de salida seleccionada en la lista.
        /// </summary>
        public new Constants.SalidasEnum SelectedValue
        {
            get
            {
                return (Constants.SalidasEnum)Convert.ToByte(base.SelectedValue);
            }
            set
            {
                base.SelectedValue = value.GetHashCode().ToString();
            }
        }
	}
}